<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"<?php if (isset($addbg)){ ?> class="addbg"<?php } ?>>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7" />
        <title>管理中心 - <?php echo C("SITE_NAME"); ?></title>
        <css href="__PUBLIC__/Admin/css/reset.css" />
        <css href="__PUBLIC__/Admin/css/system.css" />
        <css href="__PUBLIC__/Admin/css/table_form.css" />
        <js href="__PUBLIC__/Admin/js/jquery-1.9.1.js" />
        <js href="__PUBLIC__/Admin/js/admin_common.js" />
        
        <!--kindeditor begin-->
        <css href="__PUBLIC__/Admin/kindeditor/themes/default/default.css" />
        <js href="__PUBLIC__/Admin/kindeditor/kindeditor.js" />
        <js href="__PUBLIC__/Admin/kindeditor/lang/zh_CN.js" />
        <script type="text/javascript">
var editor;
KindEditor.ready(function(K) {
    editor = K.editor({
		uploadJson : '<?php echo U('uploadJson'); ?>',
		fileManagerJson : '<?php echo U('fileManagerJson'); ?>',
        allowFileManager : true,
		formatUploadUrl : false,
		extraFileUploadParams: {
			PHPSESSID: '<?php echo session_id(); ?>',
    	}
    });
    
    $(document).on('click', '.J_Upload', function() {
        var imgurl = $(this).prev('.J_Pic');
        editor.loadPlugin('image', function() {
            editor.plugin.imageDialog({
                showRemote : false,
                imageUrl : imgurl.val(),
                clickFn : function(url, title, width, height, border, align) {
                    imgurl.val(url);
                    editor.hideDialog();
                }
            });
        });
    });
});
</script>
    </head>
    <body>
        <style type="text/css">
            html{_overflow-y:scroll}
        </style>
        <script type="text/javascript">
            //显示新闻资讯左侧栏目
            window.top.$("#display_center_id").hide();
        </script>
        <div class="subnav">
            <div class="content-menu ib-a blue line-x">
                <a href="<?php echo U('ServiceContent/index', array('service_id' => $service_id)); ?>"><em>管理内容</em></a>
                <span>|</span>
                <a class="on" href="javascript:void(0);"><em>添加内容</em></a>
            </div>
        </div>
    <div class="common-form">
        <form name="myform" id="myform" action="<?php echo U('ServiceContent/add', array('service_id' => $service_id)); ?>" method="post" enctype="multipart/form-data">
            <table class="table_form contentWrap" width="100%" cellspacing="0">
                <tbody>
                    <tr>
                        <th width="100"><span class="required">*</span> 亮点标题：</th>
                        <td>
                            <input type="text" class="measure-input  input-text" name="ServiceContent[title]" style="width:400px;">
                        </td>
                    </tr>
                    <tr>
                        <th width="100"><span class="required">*</span> 亮点短标题：</th>
                        <td>
                            <input type="text" class="measure-input  input-text" name="ServiceContent[short_title]" style="width:200px;">
                        </td>
                    </tr>
                    <tr>
                        <th width="80"><span class="required">*</span> 亮点展示模板：</th>
                        <td>
                            <select id="J_tplId" name="ServiceContent[tpl_id]">
                                <option value="">==请选择模板==</option>
                                <option value="1">模板1</option>
                                <option value="2">模板2</option>
                                <option value="3">模板3</option>
                                <option value="4">模板4</option>
                                <option value="5">模板5</option>
                                <option value="6">模板6</option>
                                <option value="7">模板7</option>
                                <option value="8">模板8</option>
                                <option value="9">模板9</option>
                                <option value="10">模板10</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>模板缩率图：</th>
                        <td class="tpl-images">
                            <ul>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl1.png" width="150" height="80"><h3>模板1</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl2.png" width="150" height="80"><h3>模板2</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl3.png" width="150" height="80"><h3>模板3</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl4.png" width="150" height="80"><h3>模板4</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl5.png" width="150" height="80"><h3>模板5</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl6.png" width="150" height="80"><h3>模板6</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl7.png" width="150" height="80"><h3>模板7</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl8.png" width="150" height="80"><h3>模板8</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl9.png" width="150" height="80"><h3>模板9</h3></li>
                                <li><img src="__PUBLIC__/Admin/tpl_thumbnail/content/contentTpl10.png" width="150" height="80"><h3>模板10</h3></li>
                            </ul>
                        </td>
                    </tr>    
                    <!--动态模板 begin-->
                    <tr id="J_tplContent" style="display:none;">
                        <td colspan="2"></td>
                    </tr>
                    <!--动态模板 over--> 
                </tbody>
            </table>
            <div class="bk15"></div>
            <input type="hidden" name="ServiceContent[service_id]" value="<?php echo $service_id; ?>" />
            <input name="dosubmit" type="submit" value="提交" class="button">
        </form>
    </div>
<script type="text/javascript">
$(function() {
    $("#J_tplId").change(function() {
        var tpl_id = $(this).val();
        $.ajax({
            type: 'POST',
            url: "<?php echo U('ServiceContent/ajaxGetTpl'); ?>",
            data: {
                 tpl_id: tpl_id
            },
            dataType: 'json',
            success: function(data) {
                if (data.error_num != 0) {
                    alert(data.error_message);
                    location.reload();
                    return false;	
                }
                $("#J_tplContent").show();
                $("#J_tplContent td").html(data.content);
                return true;
            },
            error: function() {
                alert('获取模板文件失败！');
                return false;	
            }
        });
    });
});
</script>
</body>
</html>
